import java.util.*;
import java.lang.*;
import java.io.*;

public class CalendarNotes  {
		private BufferedReader kbd;

public void run()throws IOException {
    try{
    	kbd  = new BufferedReader(new InputStreamReader(System.in));//use to read a user input
    	String lineOfTXT;
    	char addLine = 'y';
    	String reply = "";

    	PrintWriter writer = null;

   		writer =  new PrintWriter(new FileWriter("NoteList.txt", true));//sends the written information
    	while(addLine == 'y'||addLine == 'Y'){
    	Scanner reader = new Scanner(System.in);
    	System.out.print("Enter the Name: ");
        name = reader.nextLine().trim();


       System.out.println("Do you wish to add more?  yes or no(y/n)? ");
       reply = kbd.readLine();
       addLine = reply.charAt(0);
}
   		 writer.close();
    	System.out.println("New record has been saved to studentList.txt.");
   }catch(FileNotFoundException error){//catches the errors on the run method
    	System.out.println("File opening error"+error.toString());
}
}
//the main method excecutes the run()
public static void main(String[] args) {
    	CalendarNotes test;
    try {
       test = new CalendarNotes();
       test.run();
    }catch (Exception e) {//catches the error within the main method
       e.printStackTrace();
}
    	System.exit(0);
}
}
